var 复活次数 = 5;
var 地图列表 = [211070100, 211070101, 211070110];
var 准备地图 = 100000000;
var 事件名称 = "事件模板";

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance(事件名称);
    for (var b = 0; b < 地图列表.length; b++) {
        var d = c.setInstanceMap(地图列表[b]);
        d.resetFully();
        d.killAllMonsters(false)
    }
    return c
}

function onPlayerRegistered(b, a) {
    b.startEventTimer(1000)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (地图列表.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    initProp("kill", 0)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(c, d, a) {
    var e = 10000;
    var b = em.getNumberProperty("kill") + 1;
    em.setProperty("kill", b);
    if (b >= e) {
        c.getPlayers().forEach(function (f) {
            f.getAPI().openNpc(2540005, "特效_完成")
        });
        em.setProperty("state", 10)
    }
    return 1
}

function onMonsterDamaged(b, a, d, e, c) {}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};